// Copyright © 2025 Alibaba Cloud. All rights reserved.
//
// Author: keria
// Date: 2025/2/19
// Brief: 单个播放项组件

import 'dart:async';
import 'dart:developer';

import 'package:aliplayer_widget/aliplayer_widget_lib.dart';
import 'package:aliplayer_widget/utils/log_util.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';
import 'package:get/get.dart';
import 'package:yyshort/common/apis/user_api.dart';
import 'package:yyshort/common/apis/video_api.dart';
import 'package:yyshort/common/model/useInfo_model.dart';
import 'package:yyshort/common/model/video_model.dart';
import 'package:yyshort/common/utils/http.dart';
import 'package:yyshort/pages/ali_player/short_video/SharedDataController.dart';
import 'package:yyshort/pages/ali_player/short_video/short_video_page.dart';
import 'package:yyshort/pages/foryou/widgets/icon_button_widget.dart';
import 'package:yyshort/pages/foryou/widgets/info_card_widget.dart';

import '../../payment/controller.dart';

/// 单个播放项组件
// ignore: must_be_immutable
class ShortVideoItem extends StatefulWidget {
  /// 视频数据源，可能是VideoModel或EpisodeModel
  late dynamic episodeInfo;
  final VideoModel? videoModel;

  /// 是否是foryou页面
  final bool isforyouPage;

  /// 是否自动播放
  final bool autoPlay;

  final VoidCallback? onTvTap; //展示视频列表
  final VoidCallback? onArrowTap; //展示转发
  final VoidCallback? watchNowTap; //foryou列表，

  Function(EpisodeModel episode) onUpdateEpisode; //更新临时已解锁信息避免请求
  Function(VideoModel videoModel) onUpdateVideoModel; //更新video islike;
  Function(EpisodeModel episode) onUnlockBtnTap; //
  //foryou列表查看剧集，收藏后回调（为什么不用上面的onUpdateVideoModel，
  //因为数据源不同，数据类型也不同，存储在page页面的不同属性，存在相同字段，每个地方都要做类型判断。）
  // Function(VideoModel videoModel)? watchNowTap;

  final Rxn<VideoModel> videoModelRx = Rxn<VideoModel>();

  ShortVideoItem({
    super.key,
    required this.episodeInfo,
    this.isforyouPage = true,
    this.autoPlay = true,
    this.onTvTap,
    this.videoModel,
    this.watchNowTap,

    required this.onUpdateEpisode(EpisodeModel episode),
    required this.onUpdateVideoModel(VideoModel videoModel),
    required this.onUnlockBtnTap(EpisodeModel episode),

    this.onArrowTap,
  }) : assert(
         episodeInfo is VideoModel || episodeInfo is EpisodeModel,
         "videoInfo must be either VideoModel or EpisodeModel",
       );

  @override
  State<ShortVideoItem> createState() => ShortVideoItemState();
}

class ShortVideoItemState extends State<ShortVideoItem> {
  /// 日志标签
  static const String _tag = "ShortVideoItem";

  /// 播放器组件控制器
  late AliPlayerWidgetController _controller;

  static BuildContext? globalContext;
  // 添加一个ValueNotifier来控制按钮显示状态
  final ValueNotifier<bool> _showUnlockButton = ValueNotifier(false);
  // final ValueNotifier<bool> _needscrollStop = ValueNotifier(false);

  /// 当前视频ID（统一获取方式）
  int? get _videoId {
    if (widget.episodeInfo is VideoModel) {
      return (widget.episodeInfo as VideoModel).id;
    } else if (widget.episodeInfo is EpisodeModel) {
      return (widget.episodeInfo as EpisodeModel).videoId;
    }
    return null;
  }

  /// 当前播放URL（统一获取方式）
  String? get _videoUrl {
    if (widget.episodeInfo is VideoModel) {
      return (widget.episodeInfo as VideoModel).url;
    } else if (widget.episodeInfo is EpisodeModel) {
      return (widget.episodeInfo as EpisodeModel).url;
    }
    return 'null';
  }

  /// 封面图URL（统一获取方式）
  String? get _coverUrl {
    if (widget.episodeInfo is VideoModel) {
      return (widget.episodeInfo as VideoModel).imgUrl;
    } else if (widget.episodeInfo is EpisodeModel) {
      return (widget.episodeInfo as EpisodeModel).imgUrl;
    }
    return 'null';
  }

  /// 视频标题（统一获取方式）
  String? get _videoTitle {
    if (widget.episodeInfo is VideoModel) {
      return (widget.episodeInfo as VideoModel).name;
    } else if (widget.episodeInfo is EpisodeModel) {
      // 对于剧集可以返回"第X集"作为标题
      return "${'剧集'.tr} ${(widget.episodeInfo as EpisodeModel).sortId}";
    }
    return 'null';
  }

  /// 视频描述（统一获取方式）
  String? get _videoDescription {
    if (widget.episodeInfo is VideoModel) {
      return (widget.episodeInfo as VideoModel).description;
    } else if (widget.episodeInfo is EpisodeModel) {
      // 可以根据需要返回剧集特定描述
      return widget.episodeInfo is EpisodeModel
          ? "${'剧集'.tr} ${(widget.episodeInfo as EpisodeModel).sortId} ${'描述'.tr}"
          : 'null';
    }
    return 'null';
  }

  // @override
  // void initState() {
  //   super.initState();
  //   debugPrint("[$_tag][lifecycle][initState]: $_videoId");
  //   // 初始化播放器组件控制器
  //   _controller = AliPlayerWidgetController(context);
  //   // 设置播放器视频源
  //   final videoSource = VideoSourceFactory.createUrlSource(
  //     _videoUrl!,
  //   );
  //   // 设置播放器组件数据
  //   final data = AliPlayerWidgetData(
  //     sceneType: SceneType.listPlayer,
  //     videoSource: videoSource,
  //     coverUrl: _coverUrl!,
  //     autoPlay: widget.autoPlay,
  //   );
  //   _controller.configure(data);
  // }
  @override
  void initState() {
    super.initState();
    debugPrint("[$_tag][lifecycle][initState]: $_videoId");
    Get.put(PaymentController()); //初始化充值控制器

    // 初始化播放器组件控制器
    _controller = AliPlayerWidgetController(context);

    // 优先触发封面图渲染，在首次build后初始化播放器
    WidgetsBinding.instance.addPostFrameCallback((_) {
      if (!_isPlayerInitialized && mounted) {
        _initializePlayerWhenReady();
      }
    });
  }

  // 添加播放器初始化状态标记
  bool _isPlayerInitialized = false;

  void _initializePlayerWhenReady() {
    if (widget.isforyouPage) {
      // 直接初始化播放器
      _initializePlayer();
    } else {
      EpisodeModel episode = widget.episodeInfo as EpisodeModel;
      // UserInfo().vipExpireTime.isNotEmpty
      //     ? _fetchVideoUrlAndInitialize()
      //     : () {
      if (episode.isUnlock == 1) {
        // 已解锁，直接播放
        _fetchVideoUrlAndInitialize();
      } else {
        // 未解锁，判断是否自动购买
        UserInfo userInfo = UserInfo();
        if (userInfo.isAutoBuy == 1) {
          if (userInfo.coin >= episode.coin! ||
              UserInfo().vipExpireTime.isNotEmpty) {
            // UserInfo().coin = userInfo.coin - episode.coin!;
            // print(
            //   '--------------用户余额${userInfo.coin}--单集解锁${episode.coin}--剩余-${UserInfo().coin}-',
            // );
            _fetchVideoUrlAndInitialize();
          } else {
            showUnLock(userInfo, episode);
            //充值弹窗
            // showRechargeSheet(episode);
          }
        } else {
          logd('未自动解锁，展示弹窗');
          WidgetsBinding.instance.addPostFrameCallback((_) {
            // showConfirmDialog(userInfo, episode);

            showUnLock(userInfo, episode);
          });
        }
      }
      // };
    }
  }

  /// 初始化播放器
  void _initializePlayer() {
    try {
      if (_isPlayerInitialized) return; // 避免重复初始化

      // 确保_videoUrl不为空，为空时使用空字符串避免错误
      final url = _videoUrl ?? "";
      // log(url);
      logd('----播放----$url');
      // 设置播放器视频源
      final videoSource = VideoSourceFactory.createUrlSource(url);

      logd(widget.autoPlay);
      // 设置播放器组件数据
      final data = AliPlayerWidgetData(
        sceneType: SceneType.listPlayer,
        videoSource: videoSource,

        // coverUrl: widget.isforyouPage ? _coverUrl ?? "" : "",
        // coverUrl: _coverUrl ?? "",
        autoPlay: widget.autoPlay,
      );
      _controller.configure(data);
      _isPlayerInitialized = true; // 标记初始化完成

      debugPrint("[$_tag][initializePlayer] 播放器初始化完成: $_videoId");
    } catch (e) {
      debugPrint("[$_tag][initializePlayer] 播放器初始化失败: $e");
    }
  }

  /// 请求视频URL并初始化播放器
  Future<void> _fetchVideoUrlAndInitialize() async {
    try {
      if (_isPlayerInitialized) return; // 避免重复初始化

      debugPrint("[$_tag][fetchVideoUrl] 开始请求视频URL: $_videoId");

      // 调用接口获取视频URL，这里假设使用VideoAPI获取
      EpisodeModel episodeModel = widget.episodeInfo as EpisodeModel;
      int tempVideoID = episodeModel.videoId!;
      int tempEpisode_id = episodeModel.id!;
      // 请根据实际接口替换此部分代码
      if (_videoId != null) {
        var resultInfo = await VideoAPI.video_episode_content(
          tempVideoID,
          tempEpisode_id,
        );
        late EpisodeModel temp;
        if (resultInfo is EpisodeModel) {
          temp = resultInfo;
          final result = temp.url;
          // 更新视频URL
          if (result != null && result.isNotEmpty) {
            // 更新_videoUrl的值
            if (widget.episodeInfo is VideoModel) {
              (widget.episodeInfo as VideoModel).url = result;
              (widget.episodeInfo as VideoModel).imgUrl = temp.imgUrl;
            } else if (widget.episodeInfo is EpisodeModel) {
              (widget.episodeInfo as EpisodeModel).url = result;
              (widget.episodeInfo as EpisodeModel).imgUrl = temp.imgUrl;
            }
            //更新外部数组：
            widget.onUpdateEpisode(temp);
            // _needscrollStop.value = false;
            debugPrint("[$_tag][fetchVideoUrl] 获取视频URL成功: $result");
            eventBus.fire(ISCanScrollEvent(true));
            // 初始化播放器
            _initializePlayer();
          } else {
            debugPrint("[$_tag][fetchVideoUrl] 获取视频URL为空");
          }
        } else {
          if (resultInfo.containsKey('code') && resultInfo['code'] == 2102) {
            //   resultInfo['code'] == 2203
            _showUnlockButton.value = true;
            eventBus.fire(ISCanScrollEvent(true));

            // showRechargeSheet(widget.episodeInfo);
            // showUnLock(userInfo, episode)
          }
        }
      } else {
        debugPrint("[$_tag][fetchVideoUrl] 视频ID为空，无法请求URL");
      }
    } catch (e) {
      debugPrint("[$_tag][fetchVideoUrl] 请求视频URL失败: $e");
    }
  }

  @override
  void dispose() {
    debugPrint("[$_tag][lifecycle][dispose]: $_videoId");

    // 销毁播放控制器
    _controller.destroy();

    super.dispose();
  }

  /// 暂停播放
  void pause() {
    debugPrint("[$_tag][paused]: $_videoId");
    _controller.pause();
  }

  /// 恢复播放
  void resume() {
    debugPrint("[$_tag][resumed]: $_videoId");
    _controller.play();
  }

  void showUnLock(UserInfo userInfo, EpisodeModel episode) {
    _showUnlockButton.value = true;
  }

  // 提取：充值弹窗方法
  void showRechargeSheet(EpisodeModel model) {
    widget.onUnlockBtnTap(model);
  }

  // 在ShortVideoItemState类中添加
  // @override
  // Widget build(BuildContext context) {
  //   logd("执行build 函数");

  //   globalContext = context;

  //   eventBus.on<StopPlayerEvent>().listen((event) {
  //     _controller.pause();
  //   });

  //   eventBus.on<VideoEvent>().listen((event) {
  //     print('接收通知---单元行--${event.videoModel.isCollect}-');
  //     widget.videoModelRx.value = event.videoModel;
  //     print(widget.videoModelRx.value!.isCollect);
  //     if (widget.episodeInfo.id == event.videoModel.id) {
  //       widget.episodeInfo.isCollect = event.videoModel.isCollect;
  //       widget.episodeInfo.isLike = event.videoModel.isLike;
  //     }
  //   });
  //   return Container(
  //     // color: Colors.black,
  //     alignment: Alignment.center,
  //     child: ValueListenableBuilder<int>(
  //       // 监听控制器中的playStateNotifier
  //       valueListenable: _controller.playStateNotifier,
  //       builder: (context, playState, child) {
  //         // 打印当前播放状态
  //         logi("当前播放状态: $playState");

  //         // 只有当状态不是播放和暂停时才显示封面
  //         final showBgImage =
  //             playState == FlutterAvpdef.unknow ||
  //             playState == FlutterAvpdef.idle ||
  //             playState == FlutterAvpdef.initalized ||
  //             playState == FlutterAvpdef.prepared;

  //         // final Duration currentPosition =
  //         //     _controller.currentPositionNotifier.value;

  //         return Stack(
  //           children: [
  //             // widget.isforyouPage
  //             //     ? _buildPlayWidget()
  //             //     : (showBgImage
  //             //           ?
  //             //             // 优先显示封面图
  //             //             Positioned.fill(child: bgImgViewWidget())
  //             //           : _buildPlayWidget()),
  //             _buildPlayWidget(),
  //             Positioned.fill(child: bgImgViewWidget()),

  //             // 播放状态为暂停时显示播放图标
  //             if (playState == FlutterAvpdef.paused)
  //               Positioned.fill(
  //                 child: Align(
  //                   alignment: Alignment.center,
  //                   child: GestureDetector(
  //                     onTap: () {
  //                       // if (widget.isforyouPage) {
  //                       resume();
  //                       // }
  //                     },
  //                     // 双击事件处理
  //                     // onDoubleTap: () {
  //                     //   // 在这里添加双击后的逻辑
  //                     //   print("播放图标被双击了");
  //                     //   resume();
  //                     //   // 例如：切换播放状态、全屏等操作
  //                     // },
  //                     child: Icon(
  //                       Icons.play_circle_rounded,
  //                       // ignore: deprecated_member_use
  //                       color: Colors.white54.withOpacity(0.5),
  //                       size: 100.w,
  //                     ),
  //                   ),
  //                 ),
  //               ),
  //           ],
  //         );
  //       },
  //     ),
  //   );
  // }

  @override
  Widget build(BuildContext context) {
    logd("执行build 函数");

    globalContext = context;

    eventBus.on<StopPlayerEvent>().listen((event) {
      _controller.pause();
    });

    eventBus.on<VideoEvent>().listen((event) {
      print('接收通知---单元行--${event.videoModel.isCollect}-');
      widget.videoModelRx.value = event.videoModel;
      print(widget.videoModelRx.value!.isCollect);
      if (widget.episodeInfo.id == event.videoModel.id) {
        widget.episodeInfo.isCollect = event.videoModel.isCollect;
        widget.episodeInfo.isLike = event.videoModel.isLike;
      }
    });

    return Container(
      alignment: Alignment.center,
      child: ValueListenableBuilder<int>(
        valueListenable: _controller.playStateNotifier,
        builder: (context, playState, child) {
          logi("当前播放状态: $playState");

          // 只有当状态不是播放和暂停时才显示封面（根据需求取反：showBgImage为true时隐藏）
          final showBgImage =
              playState == FlutterAvpdef.unknow ||
              playState == FlutterAvpdef.idle ||
              playState == FlutterAvpdef.initalized ||
              playState == FlutterAvpdef.prepared;

          final opacity = showBgImage ? 0.0 : 1.0;

          return Stack(
            children: [
              // 1. 最底层：播放组件
              _buildPlayWidget(),

              // ✅ 背景层（沾满、透明动画、不挡事件）
              AnimatedOpacity(
                duration: const Duration(milliseconds: 300),
                curve: Curves.easeOut,
                opacity: showBgImage ? 1.0 : 0.0,
                child: IgnorePointer(
                  ignoring: !showBgImage, // 当隐藏时忽略触摸事件
                  child: Offstage(
                    offstage: !showBgImage && opacity == 0.0, // 透明后彻底移除
                    child: Positioned.fill(child: bgImgViewWidget()),
                  ),
                ),
              ),

              // 3. 最上层：暂停状态的播放图标
              if (playState == FlutterAvpdef.paused)
                Positioned.fill(
                  child: Align(
                    alignment: Alignment.center,
                    child: GestureDetector(
                      onTap: resume,
                      child: Icon(
                        Icons.play_circle_rounded,
                        color: Colors.white54.withOpacity(0.5),
                        size: 100.w,
                      ),
                    ),
                  ),
                ),
            ],
          );
        },
      ),
    );
  }

  // 在ShortVideoItemState类中修改bgImgViewWidget方法
  Widget bgImgViewWidget() {
    // _controller.setScaleMode(2);

    return Stack(
      children: [
        // 1. 背景图片（最底层）
        Positioned.fill(
          child: CachedNetworkImage(
            // imageUrl: widget.videoModel?.imgUrl ?? '',
            imageUrl: _coverUrl ?? '',
            errorWidget: (context, url, error) => Icon(Icons.error),
            fit: BoxFit.cover,
            placeholder: (context, url) => Container(
              color: Colors.grey[200],
              child: Center(child: CircularProgressIndicator()),
            ),
          ),
        ),

        unlockBtton(),
      ],
    );
  }

  Widget unlockBtton() {
    return ValueListenableBuilder<bool>(
      valueListenable: _showUnlockButton,
      builder: (context, show, child) {
        if (show) {
          // eventBus.fire(ISCanScrollEvent(true));

          return Center(
            child: ElevatedButton(
              style: ElevatedButton.styleFrom(
                // ignore: deprecated_member_use
                backgroundColor: Colors.black.withOpacity(0.5),
                padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(8),
                ),
              ),
              onPressed: () async {
                print("解锁按钮被点击");
                EpisodeModel episode = widget.episodeInfo as EpisodeModel;
                UserInfo userinfo = await UserAPI.get_user_info();
                if (userinfo.coin >= episode.coin! ||
                    UserInfo().vipExpireTime.isNotEmpty) {
                  // UserInfo().coin = userInfo.coin - episode.coin!;
                  // print(
                  //   '--------------用户余额${userInfo.coin}--单集解锁${episode.coin}--剩余-${UserInfo().coin}-',
                  // );
                  _fetchVideoUrlAndInitialize();
                } else {
                  showRechargeSheet(episode);
                }

                // var resultMap = await HttpUtil().post('/user_info');
                // int usercoins = resultMap['coin'];
                // UserInfo().coin = usercoins;
                // logd('点击解锁');

                // if (usercoins >= episode.coin!) {
                //   _fetchVideoUrlAndInitialize();
                // } else {
                //   showRechargeSheet(episode);
                // }
              },
              child: Text(
                '解锁内容'.tr,
                style: TextStyle(fontSize: 16, color: Colors.white),
              ),
            ),
          );
          // Positioned(
          //   top: 0,
          //   left: 0,
          //   right: 0,
          //   bottom: 0,
          //   child: Align(
          //     alignment: Alignment.center,
          //     child:
          //    ),
          // );
        }
        return SpinKitThreeBounce(
          size: 100.w,
          color: Colors.white,
          // itemBuilder: (BuildContext context, int index) {
          //   return DecoratedBox(
          //     decoration: BoxDecoration(
          //       color: index.isEven ? Colors.white38 : Colors.white70,
          //     ),
          //   );
          // },
        );
      },
    );
  }

  /// 构建播放器组件
  Widget _buildPlayWidget() {
    // 2. 初始化数据
    if (widget.isforyouPage) {
      widget.videoModelRx.value = widget.episodeInfo is VideoModel
          ? widget.episodeInfo as VideoModel
          : null;
    } else {
      widget.videoModelRx.value = widget.videoModel;
    }

    return AliPlayerWidget(
      isforyouPage: widget.isforyouPage,
      _controller,
      overlays: [
        Visibility(
          visible: widget.isforyouPage,
          child: Positioned.fill(
            child: GestureDetector(
              onTap: () {
                // ignore: unrelated_type_equality_checks

                if (widget.isforyouPage) {}
                if (_controller.playStateNotifier.value ==
                    FlutterAvpdef.paused) {
                  resume();
                } else {
                  pause();
                }
              },
              child: Container(color: Colors.transparent),
            ),
          ),
        ),

        Visibility(
          visible: widget.isforyouPage,
          child: Positioned(
            left: 0,
            bottom: 15.h,
            width: ScreenUtil().screenWidth / 4 * 3,
            child: InfoCardWidget(
              watchNowTap: () {
                pause();
                widget.watchNowTap!();
                // jumpTo_ForYouSubVideoPage(widget.episodeInfo as VideoModel, (
                //   result,
                // ) {
                //   VideoModel tempBackModel = result as VideoModel;
                //   print('透传回掉数据isLike：${tempBackModel.isLike}');
                //   print('透传回掉数据isLike：${tempBackModel.isLike}');
                //   setState(() {
                //     widget.episodeInfo = tempBackModel;
                //   });
                //   //修改数据源
                //   // widget.watchNowTap!(tempBackModel);
                // });
              },
              title: _videoTitle!,
              detail: _videoDescription!,
            ),
          ),
        ),

        Obx(() {
          return // 右侧图标按钮 - 贴靠右侧中心偏下
          Align(
            alignment: Alignment.centerRight,
            child: Padding(
              padding: EdgeInsets.only(top: 150, right: 15),
              child: IconButtonWidget(
                width: 30.w,
                videoModel: widget.videoModelRx.value,
                isShowChooseIcon: widget.isforyouPage ? false : true,
                //收藏
                onStarTap: () {
                  // 定义一个定时器变量，用于管理延迟请求
                  Timer? _requestTimer;

                  // 更新外部数据
                  if (widget.isforyouPage) {
                    setState(() {
                      // 直接更新当前Widget中的状态
                      widget.videoModelRx.value?.isCollect =
                          widget.videoModelRx.value?.isCollect == 1 ? 0 : 1;
                    });
                  } else {
                    setState(() {
                      // 直接更新当前Widget中的状态
                      widget.videoModelRx.value?.isCollect =
                          widget.videoModelRx.value?.isCollect == 1 ? 0 : 1;
                    });
                    widget.onUpdateVideoModel(widget.videoModel!);
                  }

                  // 先取消可能存在的旧定时器
                  // ignore: unnecessary_null_comparison
                  if (_requestTimer != null && _requestTimer.isActive) {
                    _requestTimer.cancel();
                  }

                  // 设置新的定时器，2秒后执行请求
                  if (_videoId != null) {
                    _requestTimer = Timer(const Duration(seconds: 1), () {
                      VideoAPI.add_or_del_shelf(_videoId!).then((result) {
                        if (result) {
                          // 处理请求成功的逻辑
                        }
                      });
                    });
                  }
                },

                //喜欢
                onHeartTap: () {
                  Timer? requestTimer;
                  if (widget.isforyouPage) {
                    setState(() {
                      // 直接更新当前Widget中的状态（关键）
                      widget.videoModelRx.value?.isLike =
                          widget.videoModelRx.value?.isLike == 1 ? 0 : 1;
                    });
                  } else {
                    //更新外部数据
                    setState(() {
                      // 直接更新当前Widget中的状态（关键）
                      widget.videoModelRx.value?.isLike =
                          widget.videoModelRx.value?.isLike == 1 ? 0 : 1;
                    });
                    widget.onUpdateVideoModel(widget.videoModelRx.value!);
                  }

                  // 先取消可能存在的旧定时器
                  // ignore: unnecessary_null_comparison
                  if (requestTimer != null && requestTimer.isActive) {
                    requestTimer.cancel();
                  }
                  requestTimer = Timer(const Duration(seconds: 1), () {
                    VideoAPI.add_or_del_like(_videoId!).then((result) {
                      if (result) {}
                    });
                  });
                },

                /// 选集
                onTvTap: () {
                  // if (!widget.isforyouPage) {
                  widget.onTvTap!();
                },
                //分享
                onArrowTap: () {
                  widget.onArrowTap!();
                },
              ),
            ),
          );
        }),
      ],
    );
  }

  // 修改导航方法，添加回调参数
  // jumpTo_ForYouSubVideoPage(dynamic mode, ShortVideoCallback? callback) {
  //   // Get.to(
  //   //   () =>
  //   //       ShortVideoPage(preload: false, isforyouPage: false, superModel: mode),
  //   // )?.then((result) {
  //   //   // 当页面返回时调用回调函数
  //   //   if (callback != null && result != null) {
  //   //     callback(result);
  //   //   }
  //   // });
  // }
}
